package com.ruoyi.eam.service.impl;

import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.eam.doman.DictType;
import com.ruoyi.eam.mapper.DictTypeMapper;
import com.ruoyi.eam.service.IDictTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 字典类型Service业务层处理
 *
 * @author ruoyi
 * @date 2024-06-18
 */
@Service
public class DictTypeServiceImpl implements IDictTypeService
{
    @Autowired
    private DictTypeMapper dictTypeMapper;

    /**
     * 查询字典类型
     *
     * @param dictId 字典类型主键
     * @return 字典类型
     */
    @Override
    public DictType selectDictTypeByDictId(Long dictId)
    {
        return dictTypeMapper.selectDictTypeByDictId(dictId);
    }

    /**
     * 查询字典类型列表
     *
     * @param dictType 字典类型
     * @return 字典类型
     */
    @Override
    public List<DictType> selectDictTypeList(DictType dictType)
    {
        return dictTypeMapper.selectDictTypeList(dictType);
    }

    /**
     * 新增字典类型
     *
     * @param dictType 字典类型
     * @return 结果
     */
    @Override
    public int insertDictType(DictType dictType)
    {
        dictType.setCreateTime(DateUtils.getNowDate());
        return dictTypeMapper.insertDictType(dictType);
    }

    /**
     * 修改字典类型
     *
     * @param dictType 字典类型
     * @return 结果
     */
    @Override
    public int updateDictType(DictType dictType)
    {
        dictType.setUpdateTime(DateUtils.getNowDate());
        return dictTypeMapper.updateDictType(dictType);
    }

    /**
     * 批量删除字典类型
     *
     * @param dictIds 需要删除的字典类型主键
     * @return 结果
     */
    @Override
    public int deleteDictTypeByDictIds(Long[] dictIds)
    {
        return dictTypeMapper.deleteDictTypeByDictIds(dictIds);
    }

    /**
     * 删除字典类型信息
     *
     * @param dictId 字典类型主键
     * @return 结果
     */
    @Override
    public int deleteDictTypeByDictId(Long dictId)
    {
        return dictTypeMapper.deleteDictTypeByDictId(dictId);
    }
}
